/**
 * 
 */
package com.ph.shopping.facade.agent.service.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.ph.shopping.common.core.base.BaseService;
import com.ph.shopping.common.core.customenum.ResultEnum;
import com.ph.shopping.common.util.result.Result;
import com.ph.shopping.facade.agent.entity.AgentImage;
import com.ph.shopping.facade.agent.service.IAgentImageService;
import com.ph.shopping.facade.mapper.AgentImageMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

/**
 * @项目：phshopping-service-agent
 *
 * @描述：代理商图片接口
 *
 * @作者： 舒豪
 *
 * @创建时间：2017年3月10日
 *
 * @Copyright @2017 by 舒豪
 */
@Component
@Service(version="1.0.0")
public class AgentImageService extends BaseService implements IAgentImageService {

    @Autowired
    private AgentImageMapper agentImageMapper;

    public Result getAgentImageList() {
        return getResult(ResultEnum.SUCCESS,agentImageMapper.selectAll());
    }

    public Result addAgentImage(AgentImage agentImage) {
        Date date=new Date();
        agentImage.setCreateTime(date);
        agentImage.setUpdateTime(date);
        agentImageMapper.insert(agentImage);
        return getResult(ResultEnum.SUCCESS);
    }

    public Result updateAgentImage(AgentImage agentImage) {
        Date date=new Date();
        agentImage.setUpdateTime(date);
        agentImageMapper.updateByPrimaryKeySelective(agentImage);
        return getResult(ResultEnum.SUCCESS);
    }

    public Result deleteAgentImage(AgentImage agentImage) {
        agentImageMapper.delete(agentImage);
        return getResult(ResultEnum.SUCCESS);
    }

    public List<AgentImage> getAgentImageById(AgentImage agentImage) {
        return agentImageMapper.getAgentImageById(agentImage);
    }

}
